package edu.sctu.zcy.month201506.day20150622;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by wswk on 2015/6/22.
 */
public class ThreadPoolTest {

    public static void main(String[] args) {

        ExecutorService pool = Executors.newSingleThreadExecutor();

        ExecutorService p = Executors.newFixedThreadPool(2);
        Thread t = new MyThread();
        p.execute(t);
        p.shutdown();



        Thread t1 = new MyThread();
        Thread t2 = new MyThread();
        Thread t3 = new MyThread();
        Thread t4 = new MyThread();
        Thread t5 = new MyThread();


        pool.execute(t1);
        pool.execute(t2);
        pool.execute(t3);
        pool.execute(t4);
        pool.execute(t5);

        pool.shutdown();
    }


}
